<template>

	<view class="playlist-container">
		<uamhead :title=title></uamhead>
		<view class=bangming>
			<view class="tupian">
				<img :src="playtupian">
			</view>
		</view>
		<p>播放全部</p>
		<!-- 	骨架屏 -->
		<view class="skeleton">
			<m-for-skeleton :avatarSize="50" :row="1" :loading="loading" :isarc="square" v-for="(item,key) in 20"
				:key="key">
				<view>asdas</view>
			</m-for-skeleton>
		</view>
		<uni-list v-for="(item, index) in playlist" :key="index" class="list-item">
			<uni-list-item title="" note="" class="list-item-content">
				<view class="list-item-details">
					<view class="song-info" @click="navPlayer(item.id)">
						<span class="list-index">{{index + 1}}</span>
						<view>
							<b class="list-song-name">{{item.name}}</b>
							<view class="zuozhe">
								<image src="../../static/sq.png" class="tp" v-if="privileges[index].maxbr == 999000">
								</image>
								<image src="../../static/dujia.png" class="tp"
									v-if="privileges[index].flag > 60 && privileges[index].flag < 70"></image>
								<p class="list-artist-album">{{item.ar[0].name}} - {{item.al.name}}</p>
							</view>
						</view>
					</view>
				</view>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import {
		listDetail
	} from '../../common/api.js';

	export default {
		data() {
			return {
				playlist: [],
				privileges: [],
				playtupian: [],
				title: '歌单',
				loading: true, // 设置初始加载状态
			};
		},


		onLoad(option) {
			let listId = option.listid;
			listDetail(listId).then(res => {
				this.playlist = res.data.playlist.tracks;
				this.privileges = res.data.privileges;
				this.playtupian = res.data.playlist.coverImgUrl;
				this.loading = false;
			});
		},
		methods: {
			navPlayer(id) {
				console.log(id);
				uni.navigateTo({
					url: '/pages/player/player?songid=' + id,
				})
			}
		}
	};
</script>

<style scoped>
	.playlist-container {
		background-color: #f5f5f5;
	}

	.bangming {
		width: 750rpx;
		height: 450rpx;
		background-color: pink;

	}

	.tupian img {
		width: 250rpx;
		height: 250rpx;
		border-radius: 10%;
		margin: 90rpx 0 0 20rpx;
	}

	.list-item {
		border-bottom: 1px solid #e5e5e5;
		padding: 10px 0;
	}

	.list-item-content {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.list-item-details {
		flex: 1;
		display: flex;
		flex-direction: column;
	}

	.song-info {
		display: flex;
		align-items: center;
	}

	.list-index {
		color: #999;
		margin-right: 10px;
		margin-bottom: 100rpx;
	}

	.list-song-name {
		font-size: 18px;
		color: #333;
		margin-bottom: 5px;
	}

	.list-artist-album {
		font-size: 14px;
		color: #666;
		margin-bottom: 30px;
		/* 使用像素单位 */
	}

	.zuozhe {
		display: flex;
		/* 	align-items: center; */
	}

	.tp {
		width: 30rpx;
		height: 20rpx;
		margin-top: 10rpx;
		/* 		margin-right: 5px; */
	}

	.show-image {
		display: block;
	}

	.hide-image {
		display: none;
	}
</style>